unit oProcessObjects;

{
	created   10.3.2010
	author    Michal Varga
	purpose   extracts processable objects from processitem unit
}

interface
uses
  Classes, ComCtrls, oLevel, oProject, XMLIntf, oEntity, Generics.Collections,
  uOSPRand, oGeneratorData, obstacle, oPedestrian, oPhysicalEntity,
  Forms, oLogicalEntity;

type

  TProcessingObject = class abstract
  end;

  TProcessable = class abstract(TProcessingObject)
  end;

  TProcessingList = class(TProcessingObject)
    aParameters : TList;
    public
      destructor Destroy; override;
      constructor Create;
      procedure addParameter(paParam : TObject);
      property Parameters : TList read aParameters;
  end;

  TString = class(TProcessingObject)
    private
      aString: String;
      function getString_: String;
      procedure setString_(const Value: String);
    public
      property String_:String read getString_ write setString_;
      constructor Create(paValue: string);
      destructor Destroy; override;
  end;

  TProcessingStrings = class(TProcessingObject)
    private
      aMap : TStringList;
    public
      property Strings : TStringList read aMap write aMap;
      constructor Create(paMap : TStringList);
      destructor Destroy; override;
  end;

  TProcessingMap = class(TProcessingObject)
    private
      aMap : TList<TMapping>;
    public
      property Map : TList<TMapping> read aMap write aMap;
      constructor Create(paMap : TList<TMapping>);
      destructor Destroy; override;
  end;

  TInteger = class(TProcessingObject)
    private
      aInteger: Integer;
    function getInteger_: integer;
    procedure setInteger_(const Value: integer);
    public
      property Integer_: integer read getInteger_ write setInteger_;
      constructor Create(paValue: integer);
      destructor Destroy; override;
  end;

  TProcessingForm = class(TProcessingObject)
    private
      aForm: TForm;
    public
      property Form : TForm read aForm write aForm;
      constructor Create(paValue: TForm);
      destructor Destroy; override;
  end;

  TProcessingPedestrianList = class(TProcessingObject)
    private
      aList: TList<TPedestrian>;
    public
      property List : TList<TPedestrian> read aList write aList;
      constructor Create(paValue: TList<TPedestrian>);
      destructor Destroy; override;
  end;

  TProcessingPointsList = class(TProcessingObject)
    private
      aList: TPointsList;
    public
      property List : TPointsList read aList write aList;
      constructor Create(paValue: TPointsList);
      destructor Destroy; override;
  end;

  TProcessingPhysEntity = class(TProcessingObject)
    private
      aPhysEntity: TPhysicalEntity;
    public
      property PhysicalEntity :TPhysicalEntity read aPhysEntity write aPhysEntity;
      constructor Create(paValue: TPhysicalEntity);
      destructor Destroy; override;
  end;

  TProcessingLevel = class(TProcessingObject)
    private
      aLevel: TLevel;
    public
      property Level :TLevel read aLevel write aLevel;
      constructor Create(paValue: TLevel);
      destructor Destroy; override;
  end;

  TReal = class(TProcessingObject)
    private
      aReal: Real;
      function getFloat_: real;
      procedure setFloat_(const Value: Real);
    public
      property Real_: real read getFloat_ write setFloat_;
      constructor Create(paValue: real);
      destructor Destroy; override;
  end;

  TProcessingBoolList = class(TProcessingObject)
    private
      aList: TList<Boolean>;
    public
      property List :TList<Boolean> read aList write aList;
      constructor Create(paValue: TList<Boolean>);
      destructor Destroy; override;
  end;

  TProcessingXML = class(TProcessingObject)
    private
      aNode : IXMLNode;
    public
      property Node : IXMLNode read aNode write aNode;
      constructor Create(paNode : IXMLNode);
      destructor Destroy; override;
  end;

  TXMLGenerator = class(TProcessingXML)
    private
      aGeneratorData: TGeneratorData;
    public
      property GeneratorData: TGeneratorData read aGeneratorData;
      constructor Create(paNode: IXMLNode; paGeneratorData: TGeneratorData);
      destructor Destroy; override;
  end;

  TTreeViewProcesing = class(TProcessingObject)
    private
      aTree: TTreeView;
      function getTree_: TTreeView;
      procedure setTree_(paValue: TTreeView);
    public
      property Tree_:TTreeView read getTree_ write setTree_;
      constructor Create(paValue: TTreeView);
      destructor Destroy; override;
  end;

  TFrameProcesing = class(TProcessingObject)
    private
      aFrame: TFrame;
      function getFrame_: TFrame;
      procedure setFrame_(paValue: TFrame);
    public
      property Frame_:TFrame read getFrame_ write setFrame_;
      constructor Create(paValue: TFrame);
      destructor Destroy; override;
  end;


  TEntityProcessing = class(TProcessingObject)
    private
      aEntity: TEntity;
      function getEntity_: TEntity;
      procedure setEntity_(paValue: TEntity);
    public
      property Entity_:TEntity read getEntity_ write setEntity_;
      constructor Create(paValue: TEntity);
      destructor Destroy; override;
  end;

  TPedestrianData = class(TProcessingObject)
    public
      NameData: String;
      CrowdTightningData: Real;
      GainTightningData: Real;
      BarierTightningData: Real;
      DiameterData: Real;
      AvgVelocityData: Real;
      MaxVelocityData: Real;
      MaxAccelerationData: Real;
      ViewData: Real;
      constructor Create(paName: String;
                         paCrowdTightning: Real;
                         paGainTightning: Real;
                         paBarierTightning: Real;
                         paDiameter: Real = 1;
                         paAvgVelocity: Real = 4;
                         paMaxVelocity: Real = 6;
                         paMaxAcceleration: Real = 6;
                         paView: Real = 20);
      destructor Destroy; override;
  end;

  TConfignData = class(TProcessingObject)
    public
      Name: String;
      FL: String;
      LL: String;
      Paths: String;
      Ped: String;
      Arr: String;
      Arrivals: TStringList;
      RunConfig: String;
      constructor Create(
                         paFL: String;
                         paLL: String;
                         paPaths: String;
                         paPed: String;
                         paArr: String;
                         paArrivals: TStringList;
                         paRunConfig: String;
                         paName: String = '');
      destructor Destroy; override;
  end;

  TRunPropertiesData = class(TProcessingObject)
    public
      NameData: String;
      Replications: Double;
      Length: Double;
      Stats: TList<Boolean>;
      constructor Create(paName: String;paLength, paRepications: Double);
      destructor Destroy; override;
  end;

  TArrivalData = class(TProcessingObject)
    private
      aPedestrianID: String;
      aPathID: String;
      aCountGeneratorData: TGeneratorData;
      aNextGeneratorData: TGeneratorData;
      aArrivesFrom: Double;
      aArrivesTo: Double;
      aName: String;
      aPedType: Integer;
    public
      property PedestrianID: String read aPedestrianID write aPedestrianID;
      property PathID: String read aPathID write aPathID;
      property CountGeneratorData: TGeneratorData read aCountGeneratorData;
      property NextGeneratorData: TGeneratorData read aNextGeneratorData;
      property ArrivesFrom: Double read aArrivesFrom write aArrivesFrom;
      property ArrivesTo: Double read aArrivesTo write aArrivesTo;
      property Name: String read aName write aName;
      property PedType: Integer read aPedType write aPedType;
      constructor create(paName,paPedestrian, paPath: String;
                         paCountGenerator: TGeneratorData;
                         paNextGenerator: TGeneratorData;
                         paArrivesFrom, paArrivesTo: Double;
                         paPedType: Integer);
  end;

  TProcessingPedestrian = class(TProcessingObject)
    private
      aPedestrian: TProcessable;
    public
      property Pedestrian: TProcessable read aPedestrian;
      constructor create(paPedestrian: TProcessable);
  end;

  TProcessingRunProperties = class(TProcessingObject)
    private
      aRunProperties: TProcessable;
    public
      property RunProperties: TProcessable read aRunProperties;
      constructor create(paRunProperties: TProcessable);
  end;

  TProcessingPath = class(TProcessingObject)
    private
      aPath: TProcessable;
    public
      property Path: TProcessable read aPath;
      constructor create(paPath: TProcessable);
  end;

  TprocessingGenerator = class(TProcessingObject)
    private
      aGenerator: tRndm;
    public
      property Generator: tRndm read aGenerator;
      constructor Create(paGenerator: tRndm);
  end;

  TProcessingGeneratorData = class(TProcessingObject)
    private
      aData: TGeneratorData;
    public
      property Data: TGeneratorData read aData write aData;
      constructor create(paData: TGeneratorData);
  end;

  TProcessingLogicalEntity = class(TProcessingObject)
    strict private
      aCode: Integer;
      aEntity: TLogicalEntity;
    public
      property EntityType: Integer read aCode write aCode;
      property Entity: TLogicalEntity read aEntity write aEntity;
      constructor Create(paEntityType: Integer; paEntity: TLogicalEntity);
  end;

implementation

uses
  oPedestriansManager;

{ TString }

constructor TString.Create(paValue: string);
begin
  aString := paValue;
end;

destructor TString.Destroy;
begin
  inherited;
end;

function TString.getString_: String;
begin
  result := aString;
end;

procedure TString.setString_(const Value: String);
begin
  aString := Value;
end;

{ TInteger }


constructor TInteger.Create(paValue: integer);
begin
  aInteger := (paValue);
end;

destructor TInteger.Destroy;
begin

  inherited;
end;

function TInteger.getInteger_: integer;
begin
    Result := aInteger;
end;


procedure TInteger.setInteger_(const Value: integer);
begin

end;

{ TReal }

constructor TReal.Create(paValue: real);
begin
  aReal := paValue;
end;

destructor TReal.Destroy;
begin
  inherited;
end;

function TReal.getFloat_: real;
begin
  result := aReal;
end;

procedure TReal.setFloat_(const Value: Real);
begin

end;

{ TTreeViewProcesing }

constructor TTreeViewProcesing.Create(paValue: TTreeView);
begin
  aTree := paValue;
end;

destructor TTreeViewProcesing.Destroy;
begin

  inherited;
end;

function TTreeViewProcesing.getTree_: TTreeView;
begin
  Result := aTree
end;

procedure TTreeViewProcesing.setTree_(paValue: TTreeView);
begin
  aTree := paValue;
end;

{ TEntityProcessing }

constructor TEntityProcessing.Create(paValue: TEntity);
begin
  aEntity := paValue;
end;

destructor TEntityProcessing.Destroy;
begin

  inherited;
end;

function TEntityProcessing.getEntity_: TEntity;
begin
  Result := aEntity
end;

procedure TEntityProcessing.setEntity_(paValue: TEntity);
begin
  aEntity := paValue;
end;

{ TProcessingList }

procedure TProcessingList.addParameter(paParam: TObject);
begin
  aParameters.Add(paParam);
end;

constructor TProcessingList.Create;
begin
  aParameters := TList.Create;
end;

destructor TProcessingList.Destroy;
begin
  aParameters.Free;
  inherited;
end;

{ TPedestrainData }

constructor TPedestrianData.Create(paName: String; paCrowdTightning: Real;
  paGainTightning: Real; paBarierTightning: Real;
  paDiameter, paAvgVelocity, paMaxVelocity, paMaxAcceleration, paView: Real);
begin
  NameData := paName;
  CrowdTightningData := paCrowdTightning;
  GainTightningData := paGainTightning;
  BarierTightningData := paBarierTightning;
  DiameterData := paDiameter;
  AvgVelocityData := paAvgVelocity;
  MaxVelocityData := paMaxVelocity;
  MaxAccelerationData := paMaxAcceleration;
  ViewData := paView;
end;

destructor TPedestrianData.destroy;
begin
  inherited;
end;

{ TProcessingXML }

constructor TProcessingXML.Create(paNode: IXMLNode);
begin
  aNode := paNode;
end;

destructor TProcessingXML.Destroy;
begin
  inherited;
end;

{ TProcessingPhysEntity }

constructor TProcessingPhysEntity.Create(paValue: TPhysicalEntity);
begin
  aPhysEntity := paValue;
end;

destructor TProcessingPhysEntity.Destroy;
begin

  inherited;
end;

{ TProcessingMap }

constructor TProcessingMap.Create(paMap: TList<TMapping>);
begin
  aMap := paMap;
end;

destructor TProcessingMap.Destroy;
begin

  inherited;
end;

{ TProcessingLevel }

constructor TProcessingLevel.Create(paValue: TLevel);
begin
  aLevel := paValue;
end;

destructor TProcessingLevel.Destroy;
begin

  inherited;
end;

{ TArrivalData }

constructor TArrivalData.create(paName, paPedestrian, paPath: String;
  paCountGenerator: TGeneratorData; paNextGenerator: TGeneratorData; paArrivesFrom, paArrivesTo: Double;
  paPedType: Integer);
begin
  inherited create;
  aName := paName;
  aPedestrianID := paPedestrian;
  aPathID := paPath;
  aCountGeneratorData := paCountGenerator;
  aNextGeneratorData := paNextGenerator;
  aArrivesFrom := paArrivesFrom;
  aArrivesTo := paArrivesTo;
  aPedType := paPedType;
end;

{ TPedestrian }

constructor TProcessingPedestrian.create(paPedestrian: TProcessable);
begin
  aPedestrian := paPedestrian;
end;

{ TPath }

constructor TProcessingPath.create(paPath: TProcessable);
begin
  aPath := paPath;
end;

{ TXMLGenerator }

constructor TXMLGenerator.Create(paNode: IXMLNode; paGeneratorData: TGeneratorData);
begin
  inherited create(paNode);
  aGeneratorData := paGeneratorData;
end;

destructor TXMLGenerator.Destroy;
begin
  inherited;
end;

{ TprocessingGenerator }

constructor TprocessingGenerator.Create(paGenerator: tRndm);
begin
  aGenerator := paGenerator;
end;

{ TProcessingGeneratorData }

constructor TProcessingGeneratorData.create(paData: TGeneratorData);
begin
  aData := paData;
end;

{ TProcessingPointsList }

constructor TProcessingPointsList.Create(paValue: TPointsList);
begin
  aList := paValue;
end;

destructor TProcessingPointsList.Destroy;
begin
  aList.Free;
  inherited;
end;

{ TProcessingPedestrianList }

constructor TProcessingPedestrianList.Create(paValue: TList<TPedestrian>);
begin
  aList := paValue;
end;

destructor TProcessingPedestrianList.Destroy;
begin
  aList.Free;
  inherited;
end;

{ TFrameProcesing }

constructor TFrameProcesing.Create(paValue: TFrame);
begin
  aFrame := paValue;
end;

destructor TFrameProcesing.Destroy;
begin

  inherited;
end;

function TFrameProcesing.getFrame_: TFrame;
begin
  Result := aFrame;
end;

procedure TFrameProcesing.setFrame_(paValue: TFrame);
begin
  aFrame := paValue;
end;

{ TProcessingStrings }

constructor TProcessingStrings.Create(paMap: TStringList);
begin
  aMap := paMap;
end;

destructor TProcessingStrings.Destroy;
begin
  aMap.Free;
  inherited;
end;

{ TRunPropertiesData }

constructor TRunPropertiesData.Create(paName: String;paLength, paRepications: Double);
begin
  NameData := paName;
  Length := paLength;
  Replications := paRepications;
  Stats := TList<Boolean>.create;
end;

destructor TRunPropertiesData.Destroy;
begin
  Stats.Free;
  inherited;
end;

{ TProcessingRunProperties }

constructor TProcessingRunProperties.create(paRunProperties: TProcessable);
begin
  aRunProperties := paRunProperties;
end;

{ TConfignData }

constructor TConfignData.Create(paFL, paLL: String; paPaths: String; paPed: String;
  paArr: String; paArrivals: TStringList; paRunConfig: String; paName: String);
begin
  Name := paName;
  FL := paFL;
  LL := paLL;
  Paths := paPaths;
  Ped := paPed;
  Arr := paArr;
  Arrivals := paArrivals;
  RunConfig := paRunConfig;
end;

destructor TConfignData.Destroy;
begin

  inherited;
end;

{ TProcessingLogicalEntity }

constructor TProcessingLogicalEntity.Create(paEntityType: Integer;
  paEntity: TLogicalEntity);
begin
  aCode := paEntityType;
  aEntity := paEntity;
end;

{ TProcessingBoolList }

constructor TProcessingBoolList.Create(paValue: TList<Boolean>);
begin
  aList := paValue;
end;

destructor TProcessingBoolList.Destroy;
begin
  inherited;
end;

{ TProcessingForm }

constructor TProcessingForm.Create(paValue: TForm);
begin
  aForm := paValue;
end;

destructor TProcessingForm.Destroy;
begin

  inherited;
end;

end.



